/*
 * =====================================================================================
 *
 *       Filename:  constraint.cpp
 *
 *    Description:  Defines functions for constraints
 *
 *        Version:  1.0
 *        Created:  23/07/12 12:01:41
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  Moos Hueting (mh), mooshueting@gmail.com
 *   Organization:  
 *
 * =====================================================================================
 */
#include <stdlib.h>
#include "constraint.h"

float Constraint::getError(Mat src) {
    src.convertTo(src, CV_8UC1);
    if (arg < 0)
        return pow(weight*(fp(src) - goal), 2);
    else
        return pow(weight*(fpa(src, arg) - goal), 2);
}
